<template>
  <div class="register-container">
    <van-image
      round
      width="66px"
      height="66px"
      src="https://cdn.jsdelivr.net/npm/@vant/assets/cat.jpeg"
    />
    <van-form @submit="onSubmit">
      <van-cell-group inset>
        <van-field
          v-model="username"
          name="用户名"
          placeholder="请输入用户名"
          :rules="[{ required: true, message: '请填写用户名' }]"
        />
        <van-field
          v-model="password"
          type="password"
          name="密码"
          placeholder="请输入密码"
          :rules="[{ required: true, message: '请填写密码' }]"
        />
        <van-field
          v-model="sure_password"
          type="password"
          name="确认密码"
          placeholder="请确认密码"
          :rules="[{ required: true, message: '请填写密码' }]"
        />
        <van-button type="primary" native-type="submit" block>注册</van-button>
        <p>
          <router-link to="/login"> <span>已有账号去登录</span> </router-link>
        </p>
      </van-cell-group>
    </van-form>
  </div>
</template>

<script>
import { ref } from "vue";
export default {
  name: "login",
  setup() {
    const username = ref("");
    const password = ref("");
    const sure_password = ref("");
    return {
      username,
      password,
      sure_password,
    };
  },
};
</script>

<style lang="less" scoped>
.register-container {
  position: relative;
  width: 100%;
  height: 740px;
  background: #ffffff;
}
.van-image {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  margin: 150px auto;
}
.van-cell-group {
  position: absolute;
  margin-top: 65%;
  left: 0;
  right: 0;
  .van-field {
    margin: auto;
    width: 295px;
    height: 48px;
    margin-bottom: 10px;
    background-color: #f9f9f9;
  }
  .van-button {
    width: 295px;
    height: 48px;
    margin: auto;
    margin-top: 32px;
    color: #ffffff;
  }
  p {
    font-family: PingFangSC-Regular;
    color: rgba(0, 0, 0, 0.5);
    text-align: center;
    span {
      margin: 0px 12px;
    }
  }
}
a {
  color: rgba(0, 0, 0, 0.5);
}
</style>